//
//  HuankuanJiluTableViewCell.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/1.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "HuankuanJiluTableViewCell.h"
#import "JTCSM.h"


@implementation HuankuanJiluTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier  cellType:(theCellType)type{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        CGFloat cellHeight = 75;
        CGFloat top = 15;
        CGFloat height = 45;
        CGFloat space = 20;
        
        
        self.logoImageView = [[UIImageView alloc]initWithFrame:CGRectMake(space, top, cellHeight-2*top, cellHeight-2*top)];
        [df layerWithView:self.logoImageView radius:self.logoImageView.frame.size.height/2 width:0 color:nil];
        self.logoImageView.image = [UIImage imageNamed:@"个人信息1_头像.png"];
        [self.contentView addSubview:self.logoImageView];
        
        self.titleLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoImageView)+20, top, 150, (height-11)/2) text:@"1500.00" font:15 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(51, 51, 51, 1) backgroundColor:nil];
        [self.contentView addSubview:self.titleLabel];
        
        self.timeLabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.logoImageView)+20, KVIEW_Y(self.titleLabel)+11, 200, (height-11)/2) text:@"1500.00" font:12 textAlignment:NSTextAlignmentLeft texcolor:RGBACOLOR(153,153,153, 1) backgroundColor:nil];
        [self.contentView addSubview:self.timeLabel];
        
       
        if (type == IsZhangDanType) {
            self.stateLabel = [UILabel initWithFrame:CGRectMake(KSCREENWidth-300, top, 280, (height-11)/2) text:@"" font:14 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(16,161,88, 1) backgroundColor:nil];
            [self.contentView addSubview:self.stateLabel];
            
            self.bottomstateLabel = [UILabel initWithFrame:CGRectMake(KSCREENWidth-300, KVIEW_Y(self.stateLabel)+11, 280, (height-11)/2) text:@"" font:12 textAlignment:NSTextAlignmentRight texcolor:[df colorWithHexString:@"666666" alpha:1] backgroundColor:nil];
            [self.contentView addSubview:self.bottomstateLabel];
        }
        if (type == IsDefulatType) {
            self.stateLabel = [UILabel initWithFrame:CGRectMake(KSCREENWidth-300, 0, 280, cellHeight) text:@"" font:14 textAlignment:NSTextAlignmentRight texcolor:RGBACOLOR(16,161,88, 1) backgroundColor:nil];
            [self.contentView addSubview:self.stateLabel];
        }
        
        if (type == IsButtonType) {
            CGFloat labelWideth = 80;
            CGFloat labelHeight = 35;
            self.stateLabel = [UILabel initWithFrame:CGRectMake(KSCREENWidth-labelWideth-20, (cellHeight-labelHeight)/2, labelWideth, labelHeight) text:@"打开" font:14 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(51,51,51, 1) backgroundColor:KZhuTiRGB];
            [self.contentView addSubview:self.stateLabel];
            [df setTheViewYiYing:self.stateLabel shadowColor:RGBACOLOR(241, 241, 241, 1) shadowOffset:CGSizeMake(3, 3) apla:0.9];
            self.stateLabel.layer.cornerRadius = labelHeight/2;
            
        }
        
        self.contentView.frame = CGRectMake(0, 0, KSCREENWidth, 75);
        
        [df newlineViewWithHeightofTop:75 superView:self.contentView spacing:20 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
        
        
    }
    
    return self;
}

- (void)setValueWithModel:(id)model{
//       绿色  255,54,54 红色
    
//    NSIndexPath *path = model;
    
//    if (path.row%2==0) {
//        self.stateLabel.textColor = RGBACOLOR(16,161,88, 1);
//        self.stateLabel.text = @"还款成功";
//    }else{
//        self.stateLabel.textColor = RGBACOLOR(255,54,54, 1);
//        self.stateLabel.text = @"处理中";
//    }
}
@end
